package ag;

import java.util.TreeSet;

import aima.core.search.local.FitnessFunction;


public class FitnessMochila implements FitnessFunction {

	ProblemaMochila pm;
	public static int contfAcces= 0;
	public FitnessMochila(ProblemaMochila pm)
	{ 
		this.pm = pm;
	}
	@Override
	public double getValue(String individuo) {
		double val=0;
		contfAcces++;
		for (int i = 0; i<individuo.length();i++)
		{
			if(individuo.charAt(i)=='1'){
				val += pm.getValor(i);
			}
		}
		return val;
	}
}
